﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using googlemaps;
using ClientMobile.SSVService;

namespace ClientMobile
{
    public partial class m_enattente : PhoneApplicationPage
    {
        public m_enattente()

        {
            
            InitializeComponent();
            Singleton s = Singleton.Instance;
            Service1SoapClient ser = new Service1SoapClient();
            
            ser.AfficherListeMissionChauffeurEnattenteCompleted += new EventHandler<AfficherListeMissionChauffeurEnattenteCompletedEventArgs>(ser_AfficherListeMissionChauffeurEnattenteCompleted);
            ser.AfficherListeMissionChauffeurEnattenteAsync(s.Chauff.id_chauffeur);
        }

        void ser_AfficherListeMissionChauffeurEnattenteCompleted(object sender, AfficherListeMissionChauffeurEnattenteCompletedEventArgs e)
        {
            listBox.DataContext = e.Result;
            
        }

     

        private void listBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
           
            Mission a = new Mission();
            int x = listBox.SelectedIndex;
            a = (Mission)(listBox.Items[x]);
         //   MessageBox.Show(a.id_mission.ToString());
            // à regler l 'id ds le singleton
            //Service1SoapClient ser = new Service1SoapClient();
            //ser.ConsulterMissionCompleted += new EventHandler<ConsulterMissionCompletedEventArgs>(ser_ConsulterMissionCompleted);
           // ser.ConsulterMissionAsync(1);
            NavigationService.Navigate(new Uri("/Mission_attente.xaml?miss="+a.id_mission, UriKind.Relative));
        }

       

        }



    
    }
